home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / OCE Interfaces / OCETemplates.p < prev   
Encoding:
Text File  |  1993-09-16  |  72.6 KB  |  1,742 lines  |  [TEXT/MPS ]

  1. {***********************************************************
  2.  
  3. Created: Tuesday, February 23, 1993 at 6:15PM
  4.  OCETemplates.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.     ••• Apple Confidential •••
  8.     ••• Provided with AOCE Beta seed under license agreement with   •••
  9.     ••• Apple Computer, Inc.  Use for any purpose other than        •••
  10.     ••• development of AOCE-based Macintosh products is a violation •••
  11.     ••• of the license agreement.                                   •••
  12.  
  13.   Copyright Apple Computer, Inc. 1990-1993
  14.   All rights reserved
  15.  
  16. ***********************************************************}
  17.  
  18.  
  19. {$IFC UNDEFINED UsingIncludes}
  20. {$SETC UsingIncludes:= 0}
  21. {$ENDC}
  22.  
  23. {$IFC NOT UsingIncludes}
  24.     UNIT OCETemplates;
  25.     INTERFACE
  26. {$ENDC}
  27.  
  28. {$IFC UNDEFINED UsingOCETemplates}
  29. {$SETC UsingOCETemplates:= 1}
  30.  
  31. {$I+}
  32. {$SETC OCETemplatesIncludes:= UsingIncludes}
  33. {$SETC UsingIncludes:= 1}
  34.  
  35.  
  36. {$IFC UNDEFINED UsingTypes}
  37. {$I $$Shell(PInterfaces)Types.p}
  38. {$ENDC}
  39.  
  40. {$IFC UNDEFINED UsingEvents}
  41. {$I $$Shell(PInterfaces)Events.p}
  42. {$ENDC}
  43.  
  44. {$IFC UNDEFINED UsingOCE}
  45. {$I OCE.p}
  46. {$ENDC}
  47.  
  48. {$IFC UNDEFINED UsingOCEStandardMail}
  49. {$I OCEStandardMail.p}
  50. {$ENDC}
  51.  
  52. {$SETC UsingIncludes:= OCETemplatesIncludes}
  53.  
  54.  
  55.  
  56. {**********************************************************************************************}
  57. {******************************** Template Resource Constants: ********************************}
  58. {**********************************************************************************************}
  59.  
  60.  
  61. { Current versions of all the different template types: }
  62.  
  63. CONST
  64. kDETAspectVersion        = -978;
  65. kDETInfoPageVersion        = -978;
  66. kDETKillerVersion        = -978;
  67. kDETForwarderVersion    = -978;
  68. kDETFileTypeVersion        = -978;
  69.  
  70.  
  71. { "Normal" separation for template IDs within the file (this is just a suggestion; you can use whatever
  72.     separation you like, so LONGINT as two separate templates don't have overlapping resources): }
  73. kDETIDSep = 250;
  74.  
  75. { A few predefined base IDs (again, just suggestions): }
  76. kDETFirstID        = (1000);
  77. kDETSecondID    = (1000+kDETIDSep);
  78. kDETThirdID        = (1000+2*kDETIDSep);
  79. kDETFourthID    = (1000+3*kDETIDSep);
  80. kDETFifthID        = (1000+4*kDETIDSep);
  81.  
  82. { All templates include the following resource fork resources:
  83.     resource ('rstr', id+kDETTemplateName) contains the name of the template }
  84.  
  85. kDETTemplateName = 0;
  86.  
  87. { Aspect, info-pages, and forwarders include the following as well:
  88.     resource ('rstr', id+kDETRecordType) contains the type of record this applies to
  89.     resource ('rstr', id+kDETAttributeType) contains the type of attribute this applies to
  90.     resource ('detn', id+kDETAttributeValueTag) contains the tag of the attribute this applies to
  91. }
  92.  
  93. kDETRecordType                = 1;
  94. kDETAttributeType            = 2;
  95. kDETAttributeValueTag        = 3;
  96.  
  97.  
  98. { ************************************ Aspects }
  99.  
  100. { In the case of aspects, property numbers and resource id offsets are the same. Therefore, some of the following
  101.     defines are used for resource offsets, some are used for dynamically generated properties, and some are used for
  102.     both (i.e., properties which may be dynamically generated, but if they aren't, then they're taken from the
  103.     resource). Resource types are given in all cases below; even if there is no actual resource (for example in
  104.     the case of kDETAspectName), it indicates the type for the dynamically generated property.
  105.  
  106.      Type    Offset                        Description
  107.      ----    ------                        -----------
  108.     'deta'    0                            Identifies the type of resource
  109.     'detc'    kDETCode                    Is the code resource, if any is used
  110.     'rstr'    kDETAspectName                Contains the name of the item (attribute main aspect only)
  111.     'rst#'    kDETAspectCategory            Contains the internal categories for the record type (main aspect only)
  112.     'rstr'    kDETAspectKind                Is the item kind to display (main aspect only)
  113.     'detn'    kDETAspectGender            Is the gender of this kind of object for internationalization (main aspect only)
  114.     'rstr'    kDETAspectWhatIs            Is string for balloon help when item is in sublist (main aspect only)
  115.     'ICN#'    kDETAspectMainBitmap
  116.     'icl8'    kDETAspectMainBitmap
  117.     'icl4'    kDETAspectMainBitmap
  118.     'ics#'    kDETAspectMainBitmap
  119.     'ics8'    kDETAspectMainBitmap
  120.     'ics4'    kDETAspectMainBitmap
  121.     'sicn'    kDETAspectMainBitmap        Is the icon suite to display for this item type (main aspect only)
  122.     'rst#'    kDETAspectBalloons            Is a list of strings for balloon help; for each item is an info-page, it's
  123.                                         property # times 2 is used as an index into this array; if the item is not editable,
  124.                                         then the property # times 2 plus 1 is used
  125.     'rstr'    kDETAspectNewMenuName        Is the string to be used for "New ..." in the Directories menu, if any
  126.     'rstr'    kDETAspectNewEntryName        Is the name to be used for new entries (with a digit appended if not unique)
  127.     'detb'    kDETAspectNewValue            Is the value to use when creating a new attribute value; the first four bytes
  128.                                         is the tag; the rest is the attribute value contents
  129.     'dett'    kDETAspectLookup            Is the attribute-to-property translation table
  130.     'rstr'    kDETAspectDragInString        Is a string describing the action of dragging into this aspect
  131.     'rst#'    kDETAspectRecordDragIn        Is a list of type pairs; in each pair, the first is the type of a record which
  132.                                         can be dragged into this aspect, and the second is the attribute type to store
  133.                                         the reference in
  134.     'rst#'    kDETAspectRecordCatDragIn    Is a list of category/attribute type pairs; in each pair, the first is the
  135.                                         category of records which can be dragged in, and the second is the type of
  136.                                         attribute to place the alias in
  137.     'rst#'    kDETAspectAttrDragIn        Is a list of type triples; in each triple, the first is the record type which can be
  138.                                         dragged from (or "=" for any), the second is the attribute type which can be dragged
  139.                                         in, and the third is the attribute type to store the new attribute in
  140.     'rst#'    kDETAspectDragOut            Is a list of attribute types which can be dragged out of this aspect
  141.     'detm'    kDETAspectViewMenu            Is a table to fill in the view menu from
  142.     'detp'    kDETAspectReverseSort        Is a table listing which properties to sort in reverse order
  143.     'ipcw'    kDETAspectInfoPageCustomWindow    Is a specification of a custom window size/placement & whether to use the
  144.                                             page-selector (main aspect only)
  145.                                             (note: this resource should not be used for normal info-pages)
  146.     'rst#'    kDETAspectExternalCategory    Contains the external (user-visible) names which correspond to the categories in
  147.                                         kDETAspectCategory; if this resource is not present, external names are taken from
  148.                                         another template; if no other template provides an external name for a given internal
  149.                                         category, the internal name is used as the external name (main aspect only)
  150.  
  151. }
  152.  
  153. kDETAspectCode                     = 4;
  154. kDETAspectName                     = 5;
  155. kDETAspectCategory                 = 6;
  156. kDETAspectKind                     = 7;
  157. kDETAspectGender                 = 8;
  158. kDETAspectWhatIs                 = 9;
  159. kDETAspectMainBitmap            = 10;
  160. kDETAspectBalloons                = 11;
  161. kDETAspectNewMenuName            = 12;
  162. kDETAspectNewEntryName            = 13;
  163. kDETAspectNewValue                = 14;
  164. kDETAspectLookup                = 15;
  165. kDETAspectDragInString            = 16;
  166. kDETAspectDragInVerb            = 17;
  167. kDETAspectDragInSummary            = 18;
  168. kDETAspectRecordDragIn            = 19;
  169. kDETAspectRecordCatDragIn        = 20;
  170. kDETAspectAttrDragIn            = 21;
  171. kDETAspectAttrDragOut            = 22;
  172. kDETAspectViewMenu                = 23;
  173. kDETAspectReverseSort            = 24;
  174. kDETAspectInfoPageCustomWindow    = 25;
  175. kDETAspectExternalCategory        = 26;
  176.  
  177.  
  178. { Properties: }
  179.  
  180. { Each aspect has 250 attribute properties in this range: }
  181. kDETFirstLocalProperty        = 0;
  182. kDETLastLocalProperty         = (kDETFirstLocalProperty+249);
  183.  
  184. { Developers should use property numbers starting at this point: }
  185. kDETFirstDevProperty        = 40;
  186.  
  187. { Finally, the following range provide constant numeric properties for use in patterns and comparisons: }
  188. kDETFirstConstantProperty    = 250;
  189. kDETLastConstantProperty    = (kDETFirstConstantProperty+249);
  190.  
  191. { To convert a number into a constant property, add this: }
  192. kDETConstantProperty        = kDETFirstConstantProperty;
  193.  
  194. kDETZeroProperty            = (kDETConstantProperty+0);
  195. kDETOneProperty                = (kDETConstantProperty+1);
  196. kDETFalseProperty            = (kDETConstantProperty+0);
  197. kDETTrueProperty            = (kDETConstantProperty+1);
  198.  
  199. { The following apply to records, attributes, or aliases; they are the name and kind, as they appear in icon lists: }
  200. kDETPrName                     = 3050;
  201. kDETPrKind                     = 3051;
  202.  
  203. { Access mask properties: }
  204. kDETDNodeAccessMask            = 27574;    { the DNode access mask }
  205. kDETRecordAccessMask        = 27575;    { the record access mask }
  206. kDETAttributeAccessMask        = 27576;    { the attribute access mask }
  207. kDETPrimaryMaskByBit        = 27577;    { a set of sixteen properties to access all bits of the primary mask }
  208.  
  209. { See OCE documentation for details definitions of each of these bits: }
  210.  
  211. kDETPrimarySeeMask            = kDETPrimaryMaskByBit;
  212. kDETPrimaryAddMask            = (kDETPrimaryMaskByBit+1);
  213. kDETPrimaryDeleteMask        = (kDETPrimaryMaskByBit+2);
  214. kDETPrimaryChangeMask        = (kDETPrimaryMaskByBit+3);
  215. kDETPrimaryRenameMask        = (kDETPrimaryMaskByBit+4);
  216. kDETPrimaryChangePrivsMask    = (kDETPrimaryMaskByBit+5);
  217. kDETPrimaryTopMaskBit        = (kDETPrimaryMaskByBit+15);
  218.  
  219. { Template numbers (can be used with kDETAspectTemplate and kDETInfoPageTemplate target selectors): }
  220. kDETAspectTemplateNumber    = 22051;
  221. kDETInfoPageTemplateNumber    = 22052;
  222.  
  223.  
  224. { Property types are used to specify types of properties and conversions between types (negative numbers
  225.     are reserved for Apple; developer code resources can use positive numbers): }
  226. kDETPrTypeNone                 = 0;    { No type }
  227. kDETPrTypeNumber            = -1;    { A number }
  228. kDETPrTypeString            = -2;    { A STRING }
  229. kDETPrTypeBinary            = -3;    { A binary block }
  230.  
  231.  
  232. { ************************************ Info-pages }
  233.  
  234. { Info-pages include the following as well:
  235.     resource ('deti', id) identifies the type of resource; see below for details on the contents
  236.     resource ('rstr', id+kDETInfoPageName) is the name of the view to use in the page selection pop-up
  237.     resource ('rstr', id+kDETInfoPageMainViewAspect) is the name of the aspect to use with the main page view
  238.     resource ('rstr', id+kDETInfoPageMenuName) is the name of the directories menu ("Directories" if nil)
  239.     resource ('detm', id+kDETInfoPageMenuEntries) are menu entries to add after a gray line after the "New..." entries;
  240.                                                     use "-" for a gray line between entries
  241. }
  242.  
  243. kDETInfoPageName            = 4;
  244. kDETInfoPageMainViewAspect    = 5;
  245. kDETInfoPageMenuName        = 6;
  246. kDETInfoPageMenuEntries        = 7;
  247.  
  248.  
  249. { ************************************ Views }
  250.  
  251. { Flags: }
  252.  
  253. kDETNoFlags                        = $0000;  {0}
  254. kDETEnabled                        = $0001;  {1 << 0}
  255. kDETHilightIfSelected            = $0001;  {1 << 0}
  256. kDETChoosable                    = $0002;  {1 << 1}
  257. kDETNumericOnly                    = $0008;  {1 << 3}
  258. kDETMultiLine                    = $0010;  {1 << 4}
  259. kDETViewSendCommandToWindow        = $0020;  {1 << 5}
  260.  
  261. { The folowing flags make sense for views only }
  262.  
  263. { for EditText views only }
  264. kDETHidePenOnOpen                = $0100;  {1 << 8}
  265. kDETDynamicSize                    = $0200;  {1 << 9}
  266. kDETAllowNoColons                = $0400;  {1 << 10}
  267.  
  268. {    Sizes for icons4 }
  269. kDETLargeIcon        = 0;
  270. kDETSmallIcon        = 1;
  271. kDETMiniIcon        = 2;
  272.  
  273. { Stolen from TextEdit.h }
  274. kDETLeft          = 0;
  275. kDETCenter          = 1;
  276. kDETRight         = -1;
  277. kDETForceLeft    = -2;
  278.  
  279. kDETUnused                    = 0;
  280. kDETNoValue                    = $80000000;
  281. kDETNoSort                    = 0;
  282. kDETNoProperty                = -1;
  283.  
  284. { Attributes for TViewBox - these are distinct from the flags above }
  285.  
  286. kDETBoxTakesContentClicks    = $0001;  {1 << 0}
  287. kDETBoxIsRounded            = $0002;  {1 << 1}
  288. kDETBoxIsGrayed                = $0004;  {1 << 2}
  289. kDETBoxIsInvisible            = $0008;  {1 << 3}
  290.  
  291. { The common font info }
  292. kDETApplicationFont                 = 1;
  293. kDETApplicationFontSize          = 9;
  294. kDETAppFontLineHeight            = 12;
  295.  
  296. kDETSystemFont                     = 0;
  297. kDETSystemFontSize                = 12;
  298. kDETSystemFontLineHeight        = 16;
  299.  
  300. kDETDefaultFont                     = 1;
  301. kDETDefaultFontSize                 = 9;
  302. kDETDefaultFontLineHeight        = 12;
  303.  
  304. { These were taken from QuickDraw.h (where they're enums and therefore unusable in resource definitions): }
  305. kDETNormal                        = 0;
  306. kDETBold                        = 1;
  307. kDETItalic                        = 2;
  308. kDETUnderline                    = 4;
  309. kDETOutline                        = 8;
  310. kDETShadow                     = $10;
  311. kDETCondense                 = $20;
  312. kDETExtend                     = $40;
  313.  
  314. kDETIconStyle                   = -3;    { Normal for regular icons, italic for aliases }
  315.  
  316. { Views IDs: }
  317.  
  318. kDETCustomViewMenuID            = 10;
  319.  
  320. kDETChangeViewCommand        = 'view';    { Change the view; used especially in StaticCommandTextFromView sublist headers }
  321.  
  322.  
  323. { Info-page window size: }
  324. kDETRecordInfoWindHeight        = 228;
  325. kDETRecordInfoWindWidth            = 400;
  326.  
  327. kDETAttributeInfoWindHeight        = 250;
  328. kDETAttributeInfoWindWidth        = 230;
  329.  
  330.  {kDETAppFontLineHeight             = 12;}
  331.  
  332. { Note: The following defines set up an info-page layout which is for interim use only;
  333.     a more permanent layout will be defined later }
  334.  
  335. { Defines for subpages (template filled-in areas) }
  336. kDETSubpageTop            = 0;
  337. kDETSubpageLeft            = 64;
  338. kDETSubpageBottomInset    = 8;
  339. kDETSubpageRightInset    = 8;
  340.  
  341. { Page identifying icon }
  342. kDETSubpageIconTop        = 8;
  343. kDETSubpageIconLeft        = 8;
  344. kDETSubpageIconBottom    = (kDETSubpageIconTop+32);
  345. kDETSubpageIconRight    = (kDETSubpageIconLeft+32);
  346. (* #define kDETSubpageIconRect        {kDETSubpageIconTop, kDETSubpageIconLeft, kDETSubpageIconBottom, kDETSubpageIconRight} *)
  347.  
  348. { Page identifying label }
  349. kDETSubpageLabelTop        = (kDETSubpageIconBottom+8);
  350. kDETSubpageLabelLeft    = (kDETSubpageIconLeft);
  351. kDETSubpageLabelBottom    = (kDETSubpageLabelTop+kDETAppFontLineHeight);
  352. kDETSubpageLabelRight    = (kDETRecordInfoWindWidth-20);
  353. (* #define kDETSubpageLabelRect    {kDETSubpageLabelTop, kDETSubpageLabelLeft, kDETSubpageLabelBottom, kDETSubpageLabelRight} *)
  354.  
  355. { For pages with a single function, here's where the button goes }
  356. kDETSubpage1ButtonTop        = 120;
  357. kDETSubpage1ButtonLeft        = 110;
  358. kDETSubpage1ButtonBottom    = (kDETSubpage1ButtonTop+50);
  359. kDETSubpage1ButtonRight     = (kDETSubpage1ButtonLeft+200);
  360. (* #define kDETSubpage1ButtonRect        {kDETSubpage1ButtonTop, kDETSubpage1ButtonLeft, kDETSubpage1ButtonBottom, kDETSubpage1ButtonRight} *)
  361.  
  362. { Column placement for non-sublist placements }
  363. kDET1stColumnLeft            = (kDETSubpageLeft-10);
  364. kDET1stColumnRight            = (kDETSubpageLeft+68);
  365. kDET2ndColumnLeft            = (kDET1stColumnRight+2);
  366. kDETRecord2ndColumnRight    = (kDETRecordInfoWindWidth - kDETSubpageRightInset);
  367. kDETAttribute2ndColumnRight    = (kDETAttributeInfoWindWidth - kDETSubpageRightInset);
  368.  
  369. kDETColumnTop            = 38;
  370.  
  371. { Sublist placement }
  372. kDETSublistTop             = (kDETSubpageIconBottom+16+kDETAppFontLineHeight+4);
  373. kDETSublistLeft            = 10;
  374. kDETSublistBottomInset    = 10;
  375. kDETSublistBottom        = (kDETRecordInfoWindHeight - kDETSublistBottomInset);
  376. kDETSublistRightInset     = 10;
  377. kDETSublistRight        = (kDETRecordInfoWindWidth - kDETSublistRightInset);
  378.  
  379. (* #define kDETSublistRect            { kDETSublistTop, kDETSublistLeft, kDETSublistBottom, kDETSublistRight } *)
  380.  
  381. kDETSublistEntryTop        = (-kDETAppFontLineHeight/2);
  382. kDETSublistEntryBottom    = (kDETSublistEntryTop + kDETAppFontLineHeight);
  383.  
  384. (* #define kDETSublistTitleBitmapRect            { kDETListTop-10, kDETListLeftInset+4, kDETListTop-4, kDETListLeftInset+4+16 } *)
  385. kDETSublistTitleTop                    = (kDETSublistTop-kDETAppFontLineHeight-2);
  386. kDETSublistTitleBottom                = (kDETSublistTop-2);
  387. kDETSublistIconColumnWidth            = 16;
  388. kDETSublistNameColumnWidth            = 200;
  389. kDETSublistKindColumnWidth            = 96;
  390. kDETSublistSpaceBetweenColumns        = 2;
  391. kDETSublistIconColumnLeft            = kDETSublistSpaceBetweenColumns;
  392. kDETSublistIconColumnRight            = (kDETSublistIconColumnLeft + kDETSublistIconColumnWidth);
  393. kDETSublistNameColumnLeft            = (kDETSublistIconColumnRight + kDETSublistSpaceBetweenColumns);
  394. kDETSublistNameColumnRight            = (kDETSublistNameColumnLeft + kDETSublistNameColumnWidth);
  395. kDETSublistKindColumnLeft            = (kDETSublistNameColumnRight + 8); { need extra space because size is right-justified }
  396. kDETSublistKindColumnRight            = (kDETSublistKindColumnLeft + kDETSublistKindColumnWidth);
  397.  
  398.  
  399. { ************************************ Killers }
  400.  
  401. { Killers include the following as well:
  402.     resource ('rst#', id+kDETKillerName) contains a list of names to be killed
  403. }
  404.  
  405. kDETKillerName = 1;
  406.  
  407.  
  408. { ************************************ Forwarders }
  409.  
  410. { Forwarders include the following as well:
  411.     resource ('rst#', id+kDETForwarderAspectNames) contains a list of names of aspects to forward to
  412.     resource ('rst#', id+kDETInfoPageNames) contains a list of names of info-pages to forward to
  413. }
  414.  
  415. kDETForwarderTemplateNames    = 4;
  416.  
  417.  
  418.  
  419. {*********************************************************************************}
  420. {******************************** Categories: ************************************}
  421. {*********************************************************************************}
  422.  
  423. { Internal category names: }
  424.  
  425. kDETCategoryAllCategories    = 'All Categories';    { Everything in a specific category }
  426. kDETCategoryAllItems        = 'All Items';            { Everything in or out of a category }
  427. kDETCategoryAddressItems    = 'Address Items';        { Anything that can be used to address something }
  428. kDETCategoryPeople            = 'People';            { People }
  429.  
  430.  
  431.  
  432.  
  433.  
  434. {*********************************************************************************}
  435. {******************************** Code Resources: ********************************}
  436. {*********************************************************************************}
  437.  
  438. { Target specification: }
  439.  
  440. { Values of DETTargetSelector }
  441. kDETSelf = 0;                            { The "current" item }
  442. kDETSelfOtherAspect = 1;                { Another aspect of the current item }
  443. kDETParent = 2;                            { The parent (i.e., the aspect we're in the sublist of, if any) of the current item }
  444. kDETSublistItem = 3;                    { The ith item in the sublist }
  445. kDETSelectedSublistItem = 4;            { The ith selected item in the sublist }
  446. kDETDSSpec = 5;                            { The item specified by the packed DSSpec }
  447. kDETChainedTargetSpec = 6;                { A chain of specifications (apply each specification in the chain in sequence) }
  448. kDETAspectTemplate = 7;                    { A specific aspect template (number itemNumber) }
  449. kDETInfoPageTemplate = 8;                { A specific info-page template (number itemNumber) }
  450. kDETHighSelector = $F000;                { Force type to be INTEGER }
  451.  
  452. TYPE
  453. DETTargetSelector = LONGINT;
  454.  
  455. TYPE
  456. DETTargetSpecification = RECORD
  457.     selector: DETTargetSelector;        { How to pick the item (above: see) }
  458.     aspectName: RStringPtr;                { The name of the aspect (kDETSelfOtherAspect, kDETParentOtherAspect,
  459.                                             kDETSublistItem, kDETSelectedSublistItem, kDETDSSpec); nil for main aspect }
  460.     itemNumber: LONGINT;                { Sublist index (kDETSublistItem & kDETSelectedSublistItem & kDETAspectTemplate) }
  461.     dsSpec: PackedDSSpecPtr;            { DSSpec (only: kDETDSSpec) }
  462.     next: ^DETTargetSpecification;        { Next item in chain (used only when original item was kChainedTargetSpec) }
  463.     END;
  464.  
  465.  
  466. { Code resource calls and call-backs both return an OSType:
  467.         kDETDidNotHandle (1) = function not completed, try something else (used by template to say "I didn't handle it");
  468.         noErr = function completed successfully;
  469.         any error = function failed, and here's why
  470. }
  471.  
  472. CONST
  473. kDETDidNotHandle = 1;
  474.  
  475. { Call-back functions:
  476.  
  477.         reqFunction                            Action
  478.         -----------                            ------
  479.         kDETcmdBeep                            Call SysBeep; useful for testing that a code resource's calls/call-backs are working at all
  480.  
  481.         kDETcmdBusy                            Put up watch cursor and switch processes; user events elicit a beep
  482.  
  483.         kDETcmdChangeCallFors                Change call-fors mask
  484.  
  485.         kDETcmdGetCommandSelectionCount        Get the command selection count (for calls which have a command selection list)
  486.         kDETcmdGetCommandItemN                Get command selection item n (for calls which have a command selection list)
  487.  
  488.         kDETcmdGetDSSpec                    Get the PackedDSSpec for this object
  489.  
  490.         kDETcmdGetTemplateFSSpec            Get the FSSpec of the file containing the template (should be seldom used)
  491.  
  492.         kDETcmdGetOpenEdit                    Return the property of the view being edited (if any)
  493.         kDETcmdCloseEdit                    Close the current edit
  494.  
  495.         kDETcmdGetPropertyType                Get a property type
  496.  
  497.         kDETcmdGetPropertyNumber            Get a property, number format
  498.         kDETcmdGetPropertyRString            Get a property, RString format
  499.         kDETcmdGetPropertyBinarySize        Get a property, binary, return size
  500.         kDETcmdGetPropertyBinary            Get a property, binary format
  501.  
  502.         kDETcmdGetPropertyChanged            Get a property changed flag
  503.         kDETcmdGetPropertyEditable            Get a property editable flag
  504.  
  505.         kDETcmdSetPropertyType                Set a property type
  506.  
  507.         kDETcmdSetPropertyNumber            Set a property, number format
  508.         kDETcmdSetPropertyRString            Set a property, RString format
  509.         kDETcmdSetPropertyBinary            Set a property, binary data & size
  510.  
  511.         kDETcmdSetPropertyChanged            Set a property changed flag
  512.         kDETcmdSetPropertyEditable            Set a property editable flag
  513.  
  514.         kDETcmdDirtyProperty                Dirty a property (redraw: force)
  515.  
  516.         kDETcmdSublistCount                    Return the count of the sublist items
  517.         kDETcmdSelectedSublistCount            Return the count of the selected sublist items
  518.  
  519.         kDETcmdRequestSync                    Request a sync-up of the aspect with the directory
  520.  
  521.         kDETcmdAddMenu                        Add to the end of a dynamic menu
  522.         kDETcmdRemoveMenu                    Remove a dynamic menu item
  523.         kDETcmdMenuItemRString                Get a dynamic menu item RString
  524.  
  525.         kDETcmdOpenDSSpec                    PackedDSSpec open (can also be done via AppleEvents -- this is a short-cut)
  526.  
  527.         kDETcmdAboutToTalk                    About to talk to user: bring us to front, disable watch cursor, etc.
  528.  
  529.         kDETcmdBreakAttribute                Break an attribute -- apply all applicable patterns to an attribute to generate properties
  530.         kDETcmdSaveProperty                    Force a save of a property -- apply all applicable patterns to write out the property
  531.  
  532.         kDETcmdGetCustomViewUserReference    Get custom view user reference (as given in .r file)
  533.         kDETcmdGetCustomViewBounds            Get custom view current bounds
  534.  
  535.         kDETcmdGetResource                    Get a resource from a template
  536.  
  537.         kDETcmdTemplateCounts                Return number of aspect and info-page templates in system
  538.  
  539.         kDETcmdUnloadTemplates                Flush templates
  540. }
  541.  
  542.  
  543. {Values of DETCallBackFunctions }
  544. kDETcmdSimpleCallback = 0;
  545. kDETcmdBeep = 1;
  546. kDETcmdBusy = 2;
  547. kDETcmdChangeCallFors = 3;
  548. kDETcmdGetCommandSelectionCount = 4;
  549. kDETcmdGetCommandItemN = 5;
  550. kDETcmdOpenDSSpec = 6;
  551. kDETcmdAboutToTalk = 7;
  552. kDETcmdUnloadTemplates = 8;
  553. kDETcmdTemplateCounts = 9;
  554.  
  555. kDETcmdTargetedCallback = 1000;
  556. kDETcmdGetDSSpec = 1001;
  557. kDETcmdSublistCount = 1002;
  558. kDETcmdSelectedSublistCount = 1003;
  559. kDETcmdRequestSync = 1004;
  560. kDETcmdBreakAttribute = 1005;
  561. kDETcmdGetTemplateFSSpec = 1006;
  562. kDETcmdGetOpenEdit = 1007;
  563. kDETcmdCloseEdit = 1008;
  564.  
  565. kDETcmdPropertyCallback = 2000;
  566. kDETcmdGetPropertyType = 2001;
  567. kDETcmdGetPropertyNumber = 2002;
  568. kDETcmdGetPropertyRString = 2003;
  569. kDETcmdGetPropertyBinarySize = 2004;
  570. kDETcmdGetPropertyBinary = 2005;
  571. kDETcmdGetPropertyChanged = 2006;
  572. kDETcmdGetPropertyEditable = 2007;
  573. kDETcmdSetPropertyType = 2008;
  574. kDETcmdSetPropertyNumber = 2009;
  575. kDETcmdSetPropertyRString = 2010;
  576. kDETcmdSetPropertyBinary = 2011;
  577. kDETcmdSetPropertyChanged = 2012;
  578. kDETcmdSetPropertyEditable = 2013;
  579. kDETcmdDirtyProperty = 2014;
  580. kDETcmdAddMenu = 2015;
  581. kDETcmdRemoveMenu = 2016;
  582. kDETcmdMenuItemRString = 2017;
  583. kDETcmdSaveProperty = 2018;
  584. kDETcmdGetCustomViewUserReference = 2019;
  585. kDETcmdGetCustomViewBounds = 2020;
  586. kDETcmdGetResource = 2021;
  587.  
  588. kDETcmdHighCallback = $F0000000;        { Force type to be LONGINT }
  589.  
  590. TYPE
  591. DETCallBackFunctions = LONGINT;
  592.  
  593.  
  594. DETCallBackBlockHeader = RECORD
  595.     reqFunction: DETCallBackFunctions;    { Requested function }
  596.     END;
  597.  
  598. DETCallBackBlockTargetedHeader = RECORD
  599.     reqFunction: DETCallBackFunctions;    { Requested function }
  600.     target: DETTargetSpecification;        { The target for the request }
  601.     END;
  602.  
  603. DETCallBackBlockPropertyHeader = RECORD
  604.     reqFunction: DETCallBackFunctions;    { Requested function }
  605.     target: DETTargetSpecification;        { The target for the request }
  606.     property: INTEGER;                    { The property to apply the request to }
  607.     END;
  608.  
  609.  
  610. DETProtoCallBackBlock = DETCallBackBlockPropertyHeader;
  611.     
  612.  
  613.  
  614.  
  615. DETBeepBlock = DETCallBackBlockHeader;
  616.  
  617.  
  618. DETBusyBlock = DETCallBackBlockHeader;
  619.  
  620.  
  621. DETChangeCallForsBlock = RECORD
  622.     reqFunction: DETCallBackFunctions;    { Requested function }
  623.     target: DETTargetSpecification;        { The target for the request }
  624.  
  625.     newCallFors: LONGINT;                {  -> New call-for mask }
  626.     END;
  627.  
  628.  
  629. DETGetCommandSelectionCountBlock = RECORD
  630.     reqFunction: DETCallBackFunctions;    { Requested function }
  631.  
  632.     count: LONGINT;                        { <-  The number of items in the command selection list }
  633.     END;
  634.  
  635.  
  636. CONST
  637. {Values of DETItemType }
  638. kDETHFSType = 0;                        { HFS item type }
  639. kDETDSType = 1;                            { Directory Service item type }
  640. kDETMailType = 2;                        { Mail (letter) item type }
  641. kDETMoverType = 3;                        { Sounds, fonts, etc., from inside a suitcase or system file }
  642. kDETLastItemType = $F0000000;            { Force it to be a LONGINT (C & C++ seem to disagree about the definition of $F000) }
  643.  
  644. TYPE
  645. DETItemType = LONGINT;
  646.  
  647.  
  648.  
  649. DETFSInfo = RECORD                        { FSSpec plus possibly interesting additional info }
  650.     fileType: OSType;                    { File type }
  651.     fileCreator: OSType;                { File creator }
  652.     fdFlags: INTEGER;                    { Finder flags }
  653.     fsSpec: FSSpec;                        { FSSpec }
  654.     END;
  655.  
  656. DETFSInfoPtr = ^DETFSInfo;
  657.  
  658. LetterSpecPtr = ^LetterSpec;
  659. LetterSpecHandle = ^LetterSpecPtr;
  660.  
  661. DETGetCommandItemNBlock = RECORD
  662.     reqFunction: DETCallBackFunctions;    { Requested function }
  663.  
  664.     itemNumber: LONGINT;                {  -> Item number to retrieve (1-based) }
  665.     itemType: DETItemType;                {  -> Type of item to be returned (if we can interpret it as such) }
  666.     CASE INTEGER OF
  667.         1: (fsInfo: ^DETFSInfoPtr);        { <-  FSSpec & info for item (caller must disposHandle() when done) }
  668.         2: (ds: RECORD
  669.             dsSpec: ^PackedDSSpecPtr;    { <-  DSSpec for item (caller must disposHandle() when done) }
  670.             refNum: INTEGER;            { <-  Refnum for returned address }
  671.             identity: AuthIdentity;        { <-  Identity for returned address }
  672.             END);
  673.  
  674.         3: (dsSpec: ^PackedDSSpecPtr);    { <-  DSSpec for item (caller must disposHandle() when done) }
  675.         4: (ltrSpec: LetterSpecHandle);    { <-  Letter spec for item (caller must disposHandle() when done) }
  676.     END;
  677.  
  678.  
  679. DETGetDSSpecBlock = RECORD
  680.     reqFunction: DETCallBackFunctions;    { Requested function }
  681.     target: DETTargetSpecification;        { The target for the request }
  682.  
  683.     dsSpec: ^PackedDSSpecPtr;            { <-  Handle with result (caller must disposHandle() when done) }
  684.     refNum: INTEGER;                    { <-  Refnum for address if PD }
  685.     identity: AuthIdentity;                { <-  Identity for address }
  686.     isAlias: BOOLEAN;                    { <-  True if this entry is an alias }
  687.     isRecordRef: BOOLEAN;                { <-  True if this entry is a record reference }
  688.     END;
  689.  
  690.  
  691. DETGetTemplateFSSpecBlock = RECORD
  692.     reqFunction: DETCallBackFunctions;    { Requested function }
  693.     target: DETTargetSpecification;        { The target for the request }
  694.  
  695.     fsSpec: FSSpec;                        { <-  FSSpec of template file }
  696.     baseID: INTEGER;                    { <-  Base ID of this template }
  697.     aspectTemplateNumber: LONGINT;        { <-  The template number for this aspect template }
  698.     END;
  699.  
  700. DETGetOpenEditBlock = RECORD
  701.     reqFunction: DETCallBackFunctions;    { Requested function }
  702.     target: DETTargetSpecification;        { The target for the request }
  703.  
  704.     viewProperty: INTEGER;                { <- The property of the view being edited (or kNoProperty if none) }
  705.     END;
  706.  
  707. DETCloseEditBlock = RECORD
  708.     reqFunction: DETCallBackFunctions;    { Requested function }
  709.     target: DETTargetSpecification;        { The target for the request }
  710.  
  711.     END;
  712.  
  713. DETGetPropertyTypeBlock = RECORD
  714.     reqFunction: DETCallBackFunctions;    { Requested function }
  715.     target: DETTargetSpecification;        { The target for the request }
  716.     property: INTEGER;                    { The property to apply the request to }
  717.  
  718.     propertyType: INTEGER;                { <-  The type of the property }
  719.     END;
  720.  
  721.  
  722. DETGetPropertyNumberBlock = RECORD
  723.     reqFunction: DETCallBackFunctions;    { Requested function }
  724.     target: DETTargetSpecification;        { The target for the request }
  725.     property: INTEGER;                    { The property to apply the request to }
  726.  
  727.     propertyValue: LONGINT;                { <-  The value of the property }
  728.     END;
  729.  
  730.  
  731. DETGetPropertyRStringBlock = RECORD
  732.     reqFunction: DETCallBackFunctions;    { Requested function }
  733.     target: DETTargetSpecification;        { The target for the request }
  734.     property: INTEGER;                    { The property to apply the request to }
  735.  
  736.     propertyValue: RStringHandle;        { <-  A handle containing the property (as an RString) (caller must disposHandle() when done) }
  737.     END;
  738.  
  739.  
  740. DETGetPropertyBinarySizeBlock = RECORD
  741.     reqFunction: DETCallBackFunctions;    { Requested function }
  742.     target: DETTargetSpecification;        { The target for the request }
  743.     property: INTEGER;                    { The property to apply the request to }
  744.  
  745.     propertyBinarySize: LONGINT;        { <-  The size of the property as a binary block }
  746.     END;
  747.  
  748.  
  749. DETGetPropertyBinaryBlock = RECORD
  750.     reqFunction: DETCallBackFunctions;    { Requested function }
  751.     target: DETTargetSpecification;        { The target for the request }
  752.     property: INTEGER;                    { The property to apply the request to }
  753.  
  754.     propertyValue: Handle;                { <-  Handle with the value of the property (caller must disposHandle() when done) }
  755.     END;
  756.  
  757.  
  758. DETGetPropertyChangedBlock = RECORD
  759.     reqFunction: DETCallBackFunctions;    { Requested function }
  760.     target: DETTargetSpecification;        { The target for the request }
  761.     property: INTEGER;                    { The property to apply the request to }
  762.  
  763.     propertyChanged: BOOLEAN;            { <-  True if the property is marked as changed }
  764.     END;
  765.  
  766.  
  767. DETGetPropertyEditableBlock = RECORD
  768.     reqFunction: DETCallBackFunctions;    { Requested function }
  769.     target: DETTargetSpecification;        { The target for the request }
  770.     property: INTEGER;                    { The property to apply the request to }
  771.  
  772.     propertyEditable: BOOLEAN;            { <-  True if the property can be edited by the user }
  773.     END;
  774.  
  775.  
  776. DETSetPropertyTypeBlock = RECORD
  777.     reqFunction: DETCallBackFunctions;    { Requested function }
  778.     target: DETTargetSpecification;        { The target for the request }
  779.     property: INTEGER;                    { The property to apply the request to }
  780.  
  781.     newType: INTEGER;                    {  -> New type for property (just sets type, does not convert contents) }
  782.     END;
  783.  
  784.  
  785. DETSetPropertyNumberBlock = RECORD
  786.     reqFunction: DETCallBackFunctions;    { Requested function }
  787.     target: DETTargetSpecification;        { The target for the request }
  788.     property: INTEGER;                    { The property to apply the request to }
  789.  
  790.     newValue: LONGINT;                    {  -> New value to set property to (and set type to number) }
  791.     END;
  792.  
  793.  
  794. DETSetPropertyRStringBlock = RECORD
  795.     reqFunction: DETCallBackFunctions;    { Requested function }
  796.     target: DETTargetSpecification;        { The target for the request }
  797.     property: INTEGER;                    { The property to apply the request to }
  798.  
  799.     newValue: RStringPtr;                {  -> New value to set property to (and set type to RString) }
  800.     END;
  801.  
  802.  
  803. DETSetPropertyBinaryBlock = RECORD
  804.     reqFunction: DETCallBackFunctions;    { Requested function }
  805.     target: DETTargetSpecification;        { The target for the request }
  806.     property: INTEGER;                    { The property to apply the request to }
  807.  
  808.     newValue: Ptr;                        {  -> New value to set property to (and set type to binary) }
  809.     newValueSize: LONGINT;                {  -> Size of new value }
  810.     END;
  811.  
  812.  
  813. DETSetPropertyChangedBlock = RECORD
  814.     reqFunction: DETCallBackFunctions;    { Requested function }
  815.     target: DETTargetSpecification;        { The target for the request }
  816.     property: INTEGER;                    { The property to apply the request to }
  817.  
  818.     propertyChanged: BOOLEAN;            {  -> Value to set changed flag on property to }
  819.     END;
  820.  
  821.  
  822. DETSetPropertyEditableBlock = RECORD
  823.     reqFunction: DETCallBackFunctions;    { Requested function }
  824.     target: DETTargetSpecification;        { The target for the request }
  825.     property: INTEGER;                    { The property to apply the request to }
  826.  
  827.     propertyEditable: BOOLEAN;            {  -> Value to set editable flag on property to }
  828.     END;
  829.  
  830.  
  831. DETDirtyPropertyBlock = DETCallBackBlockPropertyHeader;
  832.  
  833.  
  834. DETSublistCountBlock = RECORD
  835.     reqFunction: DETCallBackFunctions;    { Requested function }
  836.     target: DETTargetSpecification;        { The target for the request }
  837.  
  838.     count: LONGINT;                        { <-  The number of items in the current item's sublist }
  839.     END;
  840.  
  841.  
  842. DETSelectedSublistCountBlock = RECORD
  843.     reqFunction: DETCallBackFunctions;    { Requested function }
  844.     target: DETTargetSpecification;        { The target for the request }
  845.  
  846.     count: LONGINT;                        { <-  The number of selected items in the current item's sublist }
  847.     END;
  848.  
  849.  
  850. DETRequestSyncBlock =  DETCallBackBlockTargetedHeader;
  851.  
  852.  
  853. DETAddMenuBlock = RECORD
  854.     reqFunction: DETCallBackFunctions;    { Requested function }
  855.     target: DETTargetSpecification;        { The target for the request }
  856.     property: INTEGER;                    { The property to apply the request to }
  857.  
  858.     name: ^RString;                        {  -> Name of new menu item }
  859.     parameter: LONGINT;                    {  -> Parameter to return when this item is selected }
  860.     addAfter: LONGINT;                    {  -> Parameter of entry to add after, or -1 for add at end }
  861.     END;
  862.  
  863.  
  864. DETRemoveMenuBlock = RECORD
  865.     reqFunction: DETCallBackFunctions;    { Requested function }
  866.     target: DETTargetSpecification;        { The target for the request }
  867.     property: INTEGER;                    { The property to apply the request to }
  868.  
  869.     itemToRemove: LONGINT;                {  -> Parameter of menu item to remove }
  870.     END;
  871.  
  872.  
  873. DETMenuItemRStringBlock = RECORD
  874.     reqFunction: DETCallBackFunctions;    { Requested function }
  875.     target: DETTargetSpecification;        { The target for the request }
  876.     property: INTEGER;                    { The property to apply the request to }
  877.  
  878.     itemParameter: LONGINT;                {  -> Parameter of menu item to return STRING for }
  879.     rString: RStringHandle;                { <-  Handle with the RString (caller must disposHandle() when done) }
  880.     END;
  881.  
  882.  
  883. DETOpenDSSpecBlock = RECORD
  884.     reqFunction: DETCallBackFunctions;    { Requested function }
  885.  
  886.     dsSpec: PackedDSSpecPtr;            {  -> DSSpec of object to be opened }
  887.     END;
  888.  
  889.  
  890. DETAboutToTalkBlock = DETCallBackBlockHeader;
  891.  
  892.  
  893. DETBreakAttributeBlock = RECORD
  894.     reqFunction: DETCallBackFunctions;    { Requested function }
  895.     target: DETTargetSpecification;        { The target for the request }
  896.  
  897.     breakAttribute: AttributePtr;        {  -> Attribute to parse }
  898.     END;
  899.  
  900.  
  901. DETSavePropertyBlock = DETCallBackBlockPropertyHeader;
  902.  
  903.  
  904. DETGetCustomViewUserReferenceBlock = RECORD
  905.     reqFunction: DETCallBackFunctions;    { Requested function }
  906.     target: DETTargetSpecification;        { The target for the request }
  907.     property: INTEGER;                    { The property to apply the request to }
  908.  
  909.     userReference: INTEGER;                { <-  User reference value, as specified in the .r file }
  910.     END;
  911.  
  912.  
  913. DETGetCustomViewBoundsBlock = RECORD
  914.     reqFunction: DETCallBackFunctions;    { Requested function }
  915.     target: DETTargetSpecification;        { The target for the request }
  916.     property: INTEGER;                    { The property to apply the request to }
  917.  
  918.     bounds: Rect;                        { <-  Bounds of the view }
  919.     END;
  920.  
  921.  
  922. DETGetResourceBlock = RECORD
  923.     reqFunction: DETCallBackFunctions;    { Requested function }
  924.     target: DETTargetSpecification;        { The target for the request }
  925.     property: INTEGER;                    { The property to apply the request to }
  926.  
  927.     resourceType: ResType;                {  -> Resource type }
  928.     theResource: Handle;                { <-  The resource handle (caller must dispose when done) }
  929.     END;
  930.  
  931. DETTemplateCounts = RECORD
  932.     reqFunction: DETCallBackFunctions;    { Requested function }
  933.  
  934.     aspectTemplateCount: LONGINT;        { <-  Number of aspect templates in the system }
  935.     infoPageTemplateCount: LONGINT;        { <-  Number of info-page templates in the system }
  936.     END;
  937.  
  938.  
  939. DETUnloadTemplatesBlock = DETCallBackBlockHeader;
  940.  
  941.  
  942.  
  943. DETCallBackBlock = RECORD
  944.     CASE INTEGER OF
  945.         1: (protoCallBack: DETProtoCallBackBlock);
  946.         2: (beep: DETBeepBlock);
  947.         3: (busy: DETBusyBlock);
  948.         4: (changeCallFors: DETChangeCallForsBlock);
  949.         5: (getCommandSelectionCount: DETGetCommandSelectionCountBlock);
  950.         6: (getCommandItemN: DETGetCommandItemNBlock);
  951.         7: (getDSSpec: DETGetDSSpecBlock);
  952.         8: (getTemplateFSSpec: DETGetTemplateFSSpecBlock);
  953.         9: (getOpenEdit: DETGetOpenEditBlock);
  954.         10: (closeEdit: DETCloseEditBlock);
  955.         11: (getPropertyType: DETGetPropertyTypeBlock);
  956.         12: (getPropertyNumber: DETGetPropertyNumberBlock);
  957.         13: (getPropertyRString: DETGetPropertyRStringBlock);
  958.         14: (getPropertyBinarySize: DETGetPropertyBinarySizeBlock);
  959.         15: (getPropertyBinary: DETGetPropertyBinaryBlock);
  960.         16: (getPropertyChanged: DETGetPropertyChangedBlock);
  961.         17: (getPropertyEditable: DETGetPropertyEditableBlock);
  962.         18: (setPropertyType: DETSetPropertyTypeBlock);
  963.         19: (setPropertyNumber: DETSetPropertyNumberBlock);
  964.         20: (setPropertyRString: DETSetPropertyRStringBlock);
  965.         21: (setPropertyBinary: DETSetPropertyBinaryBlock);
  966.         22: (setPropertyChanged: DETSetPropertyChangedBlock);
  967.         23: (setPropertyEditable: DETSetPropertyEditableBlock);
  968.         24: (dirtyProperty: DETDirtyPropertyBlock);
  969.         25: (sublistCount: DETSublistCountBlock);
  970.         26: (selectedSublistCount: DETSelectedSublistCountBlock);
  971.         27: (requestSync: DETRequestSyncBlock);
  972.         28: (addMenu: DETAddMenuBlock);
  973.         29: (removeMenu: DETRemoveMenuBlock);
  974.         30: (menuItemRString: DETMenuItemRStringBlock);
  975.         31: (openDSSpec: DETOpenDSSpecBlock);
  976.         32: (aboutToTalk: DETAboutToTalkBlock);
  977.         33: (breakAttribute: DETBreakAttributeBlock);
  978.         34: (saveProperty: DETSavePropertyBlock);
  979.         35: (getCustomViewUserReference: DETGetCustomViewUserReferenceBlock);
  980.         36: (getCustomViewBounds: DETGetCustomViewBoundsBlock);
  981.         37: (getResource: DETGetResourceBlock);
  982.         38: (templateCounts: DETTemplateCounts);
  983.         39: (unloadTemplates: DETUnloadTemplatesBlock);
  984.     END;
  985.  
  986. DETCallBackBlockPtr = ^DETCallBackBlock;
  987.  
  988.  
  989. DETCallBack = ProcPtr;
  990.     { FUNCTION DETCallBack(
  991.         callBlockPtr: ^DETCallBlock, DETCallBackBlockPtr callBackBlockPtr): OSErr;}
  992.  
  993.  
  994. { Call functions:
  995.  
  996.         reqFunction                        Action
  997.         -----------                        ------
  998.         kDETcmdInit                        Called once when template is first loaded (good time to allocate private data); returns call-for list
  999.         kDETcmdExit                        Called once when template is freed (good time to free private data)
  1000.  
  1001.         kDETcmdInstanceInit                Called once when instance of template is started (good time to allocate private instance data)
  1002.         kDETcmdInstanceExit                Called once when instance is ended (good time to free private instance data)
  1003.  
  1004.         kDETcmdIdle                        Called periodically during idle times
  1005.  
  1006.         kDETcmdPropertyCommand            Command received in the property number range (usually means a button's been pushed)
  1007.  
  1008.         kDETcmdControlEnabled            Called to determine if a control is enabled
  1009.         kDETcmdMaximumTextLength        Return maximum size for text form of property
  1010.  
  1011.         kDETcmdViewListChanged            Called when the window view-list (list of enabled views) has changed
  1012.  
  1013.         kDETcmdPropertyDirtied            Property dirtied, need to redraw
  1014.  
  1015.         kDETcmdValidateSave                Validate save: about to save info-page, return noErr (1: or) if it's OK to do so
  1016.  
  1017.         kDETcmdDropQuery                Drop query: return the appropriate operation for this drag; ask destination
  1018.         kDETcmdDropMeQuery                Drop query: return the appropriate operation for this drag; ask dropee
  1019.  
  1020.         kDETcmdAttributeCreation        New attribute creation about to occur; this gives the template chance to modify
  1021.                                         the value that's about to be created
  1022.         kDETcmdAttributeNew                Attribute value new (return 1 to let normal new processing occur)
  1023.         kDETcmdAttributeChange            Attribute value change (return 1 to let normal change processing occur)
  1024.         kDETcmdAttributeDelete            Attribute value delete (return 1 to let normal deletion occur); sent to the
  1025.                                         main aspect of the attribute that's about to be deleted
  1026.  
  1027.         kDETcmdPatternIn                Code resource pattern element on reading in an attribute or property
  1028.         kDETcmdPatternOut                Code resource pattern element on writing out an attribute or property
  1029.  
  1030.         kDETcmdShouldSync                Check if the code resource wants to force a sync (update data from directory)
  1031.         kDETcmdDoSync                    Give code resource a chance to sync (read in and break all attributes)
  1032.  
  1033.         kDETcmdOpenSelf                    Self open
  1034.  
  1035.         kDETcmdConvertToNumber            Convert template-defined property type to number
  1036.         kDETcmdConvertToRString            Convert template-defined property type to RString
  1037.         kDETcmdConvertFromNumber        Convert from number to template-defined property type
  1038.         kDETcmdConvertFromRString        Convert from RString to template-defined property type
  1039.  
  1040.         kDETcmdCustomViewDraw            Custom view draw
  1041.         kDETcmdCustomViewMouseDown        Custom view mouse down
  1042.         kDETcmdCustomViewKeyPress        Custom view key press
  1043.         kDETcmdCustomViewPaste            Custom view paste
  1044.  
  1045.         kDETcmdCustomMenuSelected        Custom menu selected
  1046.         kDETcmdCustomMenuEnabled        Custom menu enabled
  1047.  
  1048.         kDETcmdDynamicForwarders        Return a list of dynamically created forwarders
  1049.         kDETcmdDynamicResource            Return a dynamically created resource
  1050. }
  1051.  
  1052.  
  1053. CONST
  1054. { Values of DETCallFunctions }
  1055. kDETcmdSimpleCall = 0;
  1056. kDETcmdInit = 1;
  1057. kDETcmdExit = 2;
  1058. kDETcmdAttributeCreation = 3;
  1059. kDETcmdDynamicForwarders = 4;
  1060.  
  1061. kDETcmdTargetedCall = 1000;
  1062. kDETcmdInstanceInit = 1001;
  1063. kDETcmdInstanceExit = 1002;
  1064. kDETcmdIdle = 1003;
  1065. kDETcmdViewListChanged = 1004;
  1066. kDETcmdValidateSave = 1005;
  1067. kDETcmdDropQuery = 1006;
  1068. kDETcmdDropMeQuery = 1007;
  1069. kDETcmdAttributeNew = 1008;
  1070. kDETcmdAttributeChange = 1009;
  1071. kDETcmdOpenSelf = 1010;
  1072. kDETcmdDynamicResource = 1011;
  1073. kDETcmdAttributeDelete = 1012;
  1074. kDETcmdShouldSync = 1013;
  1075. kDETcmdDoSync = 1014;
  1076.  
  1077. kDETcmdPropertyCall = 2000;
  1078. kDETcmdPropertyCommand = 2001;
  1079. kDETcmdControlEnabled = 2002;
  1080. kDETcmdMaximumTextLength = 2003;
  1081. kDETcmdPropertyDirtied = 2004;
  1082. kDETcmdPatternIn = 2005;
  1083. kDETcmdPatternOut = 2006;
  1084. kDETcmdConvertToNumber = 2007;
  1085. kDETcmdConvertToRString = 2008;
  1086. kDETcmdConvertFromNumber = 2009;
  1087. kDETcmdConvertFromRString = 2010;
  1088. kDETcmdCustomViewDraw = 2011;
  1089. kDETcmdCustomViewMouseDown = 2012;
  1090. kDETcmdCustomViewKeyPress = 2013;
  1091. kDETcmdCustomMenuSelected = 2014;
  1092. kDETcmdCustomMenuEnabled = 2015;
  1093. kDETcmdCustomViewPaste = 2016;
  1094.  
  1095. kDETcmdHighCall = $F0000000;
  1096.  
  1097. TYPE
  1098. DETCallFunctions = LONGINT;
  1099.  
  1100.  
  1101. DETCallBlockHeader = RECORD
  1102.     reqFunction: DETCallFunctions;        { Requested function }
  1103.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1104.                                             common to all invocations of code resource) }
  1105.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1106.                                             code resource) }
  1107.     callBack: DETCallBack;                { Pointer to call-back routine }
  1108.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1109.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1110.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1111.     END;
  1112.     
  1113. DETCallBlockPropertyHeader = RECORD
  1114.     reqFunction: DETCallFunctions;        { Requested function }
  1115.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1116.                                             common to all invocations of code resource) }
  1117.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1118.                                             code resource) }
  1119.     callBack: DETCallBack;                { Pointer to call-back routine }
  1120.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1121.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1122.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1123.     property: INTEGER;                    { The property number the call refers to }
  1124.     END;
  1125.  
  1126. DETProtoCallBlock = DETCallBlockPropertyHeader;
  1127.  
  1128.  
  1129. DETInitBlock = RECORD
  1130.     reqFunction: DETCallFunctions;        { Requested function }
  1131.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1132.                                             common to all invocations of code resource) }
  1133.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1134.                                             code resource) }
  1135.     callBack: DETCallBack;                { Pointer to call-back routine }
  1136.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1137.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1138.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1139.  
  1140.     newCallFors: LONGINT;                { <-  New call-for mask }
  1141.     END;
  1142.  
  1143.  
  1144. DETExitBlock = DETCallBlockHeader;
  1145.  
  1146.  
  1147. DETInstanceInitBlock = DETCallBlockHeader;
  1148.  
  1149.  
  1150. DETInstanceExitBlock = DETCallBlockHeader;
  1151.  
  1152.  
  1153. DETInstanceIdleBlock = DETCallBlockHeader;
  1154.  
  1155.  
  1156. DETPropertyCommandBlock = RECORD
  1157.     reqFunction: DETCallFunctions;        { Requested function }
  1158.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1159.                                             common to all invocations of code resource) }
  1160.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1161.                                             code resource) }
  1162.     callBack: DETCallBack;                { Pointer to call-back routine }
  1163.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1164.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1165.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1166.     property: INTEGER;                    { The property number the call refers to }
  1167.  
  1168.     parameter: LONGINT;                    {  -> Parameter of command }
  1169.     END;
  1170.  
  1171.  
  1172. DETControlEnabledBlock = RECORD
  1173.     reqFunction: DETCallFunctions;        { Requested function }
  1174.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1175.                                             common to all invocations of code resource) }
  1176.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1177.                                             code resource) }
  1178.     callBack: DETCallBack;                { Pointer to call-back routine }
  1179.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1180.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1181.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1182.     property: INTEGER;                    { The property number the call refers to }
  1183.  
  1184.     isEnabled: BOOLEAN;                    { <-  Return true if the control should be enabled }
  1185.     END;
  1186.  
  1187.  
  1188. DETMaximumTextLengthBlock = RECORD
  1189.     reqFunction: DETCallFunctions;        { Requested function }
  1190.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1191.                                             common to all invocations of code resource) }
  1192.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1193.                                             code resource) }
  1194.     callBack: DETCallBack;                { Pointer to call-back routine }
  1195.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1196.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1197.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1198.     property: INTEGER;                    { The property number the call refers to }
  1199.  
  1200.     maxSize: LONGINT;                    { <-  Return the maximum size of the property as a text STRING }
  1201.     END;
  1202.  
  1203.  
  1204. DETViewListChangedBlock = DETCallBlockHeader;
  1205.  
  1206.  
  1207. DETPropertyDirtiedBlock = DETCallBlockPropertyHeader;
  1208.  
  1209.  
  1210. DETValidateSaveBlock = RECORD
  1211.     reqFunction: DETCallFunctions;        { Requested function }
  1212.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1213.                                             common to all invocations of code resource) }
  1214.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1215.                                             code resource) }
  1216.     callBack: DETCallBack;                { Pointer to call-back routine }
  1217.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1218.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1219.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1220.  
  1221.     errorString: RStringHandle;            { <-  Handle with error STRING if validation fails (callee must allocate handle, DE will DisposHandle() it) }
  1222.     END;
  1223.  
  1224. { Valid commandIDs for DETDropQueryBlock and DETDropMeQueryBlock (in addition to property numbers): }
  1225. CONST
  1226. kDETDoNothing    = 'xxx0';
  1227. kDETMove        = 'move';
  1228. kDETDrag        = 'drag';
  1229. kDETAlias        = 'alis';
  1230.  
  1231. TYPE
  1232. DETDropQueryBlock = RECORD
  1233.     reqFunction: DETCallFunctions;        { Requested function }
  1234.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1235.                                             common to all invocations of code resource) }
  1236.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1237.                                             code resource) }
  1238.     callBack: DETCallBack;                { Pointer to call-back routine }
  1239.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1240.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1241.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1242.  
  1243.     modifiers: INTEGER;                    {  -> Modifiers at drop time (option/control/command/shift keys) }
  1244.     commandID: LONGINT;                    { <-> Command ID (aeDoNothing, aeMove, aeCopy, aeAlias, or a property number) }
  1245.     destinationType: AttributeType;        { <-> Type to convert attribute to }
  1246.     copyToHFS: BOOLEAN;                    { <-  If true, object should be copied to HFS before being operated on, and deleted after }
  1247.     END;
  1248.  
  1249.  
  1250. DETDropMeQueryBlock = RECORD
  1251.     reqFunction: DETCallFunctions;        { Requested function }
  1252.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1253.                                             common to all invocations of code resource) }
  1254.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1255.                                             code resource) }
  1256.     callBack: DETCallBack;                { Pointer to call-back routine }
  1257.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1258.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1259.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1260.  
  1261.     modifiers: INTEGER;                    {  -> Modifiers at drop time (option/control/command/shift keys) }
  1262.     commandID: LONGINT;                    { <-> Command ID (aeDoNothing, aeMove, aeCopy, aeAlias, or a property number) }
  1263.     destinationType: AttributeType;        { <-> Type to convert attribute to }
  1264.     copyToHFS: BOOLEAN;                    { <-  If true, object should be copied to HFS before being operated on, and deleted after }
  1265.     END;
  1266.  
  1267.  
  1268. DETAttributeCreationBlock = RECORD
  1269.     reqFunction: DETCallFunctions;        { Requested function }
  1270.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1271.                                             common to all invocations of code resource) }
  1272.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1273.                                             code resource) }
  1274.     callBack: DETCallBack;                { Pointer to call-back routine }
  1275.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1276.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1277.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1278.  
  1279.     parent: PackedDSSpecPtr;            {  -> The object within which the creation will occur }
  1280.     refNum: INTEGER;                    {  -> Refnum for returned address (DSSpecs in PDs only) }
  1281.     identity: AuthIdentity;                {  -> The identity we're browsing as in the parent object }
  1282.     attrType: AttributeType;            { <-> The type of the attribute being created }
  1283.     attrTag: AttributeTag;                { <-> The tag of the attribute being created }
  1284.     value: Handle;                        { <-> The value to write (pre-allocated, resize as needed) }
  1285.     END;
  1286.  
  1287.  
  1288. DETAttributeNewBlock = RECORD
  1289.     reqFunction: DETCallFunctions;        { Requested function }
  1290.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1291.                                             common to all invocations of code resource) }
  1292.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1293.                                             code resource) }
  1294.     callBack: DETCallBack;                { Pointer to call-back routine }
  1295.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1296.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1297.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1298.  
  1299.     parent: PackedDSSpecPtr;            {  -> The object within which the creation will occur }
  1300.     refNum: INTEGER;                    {  -> Refnum for returned address (DSSpecs in PDs only) }
  1301.     identity: AuthIdentity;                {  -> The identity we're browsing as in the parent object }
  1302.     attrType: AttributeType;            { <-> The type of the attribute being created }
  1303.     attrTag: AttributeTag;                { <-> The tag of the attribute being created }
  1304.     value: Handle;                        { <-> The value to write (pre-allocated, resize as needed) }
  1305.     END;
  1306.  
  1307.  
  1308. DETAttributeChangeBlock = RECORD
  1309.     reqFunction: DETCallFunctions;        { Requested function }
  1310.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1311.                                             common to all invocations of code resource) }
  1312.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1313.                                             code resource) }
  1314.     callBack: DETCallBack;                { Pointer to call-back routine }
  1315.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1316.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1317.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1318.  
  1319.     parent: PackedDSSpecPtr;            {  -> The object within which the creation will occur }
  1320.     refNum: INTEGER;                    {  -> Refnum for returned address (DSSpecs in PDs only) }
  1321.     identity: AuthIdentity;                {  -> The identity we're browsing as in the parent object }
  1322.     attrType: AttributeType;            { <-> The type of the attribute being changed }
  1323.     attrTag: AttributeTag;                { <-> The tag of the attribute being changed }
  1324.     attrCID: AttributeCreationID;        { <-> The CID of the attribute being changed }
  1325.     value: Handle;                        { <-> The value to write (pre-allocated, resize as needed) }
  1326.     addAgain: BOOLEAN;                    { <-  True if returned attribute should be added rather than changed (when returning 1) }
  1327.     END;
  1328.  
  1329. DETAttributeDeleteBlock = RECORD
  1330.     reqFunction: DETCallFunctions;        { Requested function }
  1331.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1332.                                             common to all invocations of code resource) }
  1333.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1334.                                             code resource) }
  1335.     callBack: DETCallBack;                { Pointer to call-back routine }
  1336.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1337.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1338.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1339.  
  1340.     dsSpec: PackedDSSpecPtr;            {  -> The object within which the deletion will occur }
  1341.     refNum: INTEGER;                    {  -> Refnum for returned address (DSSpecs in PDs only) }
  1342.     identity: AuthIdentity;                {  -> The identity we're browsing as }
  1343.     END;
  1344.  
  1345. DETShouldSyncBlock = RECORD
  1346.     reqFunction: DETCallFunctions;        { Requested function }
  1347.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1348.                                             common to all invocations of code resource) }
  1349.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1350.                                             code resource) }
  1351.     callBack: DETCallBack;                { Pointer to call-back routine }
  1352.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1353.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1354.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1355.  
  1356.     shouldSync: BOOLEAN;                { <-  True if we should now sync with directory }
  1357.     END;
  1358.  
  1359. DETDoSyncBlock = RECORD
  1360.     reqFunction: DETCallFunctions;        { Requested function }
  1361.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1362.                                             common to all invocations of code resource) }
  1363.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1364.                                             code resource) }
  1365.     callBack: DETCallBack;                { Pointer to call-back routine }
  1366.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1367.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1368.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1369.     END;
  1370.  
  1371. DETPatternInBlock = RECORD
  1372.     reqFunction: DETCallFunctions;        { Requested function }
  1373.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1374.                                             common to all invocations of code resource) }
  1375.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1376.                                             code resource) }
  1377.     callBack: DETCallBack;                { Pointer to call-back routine }
  1378.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1379.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1380.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1381.     property: INTEGER;                    { The property number the call refers to }
  1382.  
  1383.     elementType: LONGINT;                {  -> Element type from pattern }
  1384.     extra: LONGINT;                        {  -> Extra field from pattern }
  1385.     attribute: AttributePtr;            {  -> The complete attribute }
  1386.     dataOffset: LONGINT;                {  -> Offset to current (next) byte }
  1387.     bitOffset: INTEGER;                    {  -> Bit offset (next bit ^is fData >> fBitOffset++) }
  1388.     END;
  1389.  
  1390.  
  1391. DETPatternOutBlock = RECORD
  1392.     reqFunction: DETCallFunctions;        { Requested function }
  1393.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1394.                                             common to all invocations of code resource) }
  1395.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1396.                                             code resource) }
  1397.     callBack: DETCallBack;                { Pointer to call-back routine }
  1398.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1399.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1400.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1401.     property: INTEGER;                    { The property number the call refers to }
  1402.  
  1403.     elementType: LONGINT;                {  -> Element type from pattern }
  1404.     extra: LONGINT;                        {  -> Extra field from pattern }
  1405.     attribute: AttributePtr;            {  -> The attribute (minus the data portion) }
  1406.     data: Handle;                        {  -> Data to be written (pre-allocated, resize and add at end) }
  1407.     dataOffset: LONGINT;                {  -> Offset to next byte to write }
  1408.     bitOffset: INTEGER;                    {  -> Bit offset (zero: if; handle will need to be resized to one more byte before write) }
  1409.     END;
  1410.  
  1411.  
  1412. DETOpenSelfBlock = RECORD
  1413.     reqFunction: DETCallFunctions;        { Requested function }
  1414.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1415.                                             common to all invocations of code resource) }
  1416.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1417.                                             code resource) }
  1418.     callBack: DETCallBack;                { Pointer to call-back routine }
  1419.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1420.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1421.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1422.     property: INTEGER;                    { The property number the call refers to }
  1423.  
  1424.     modifiers: INTEGER;                    { -> Modifiers at open time (option/control/command/shift keys) }
  1425.     END;
  1426.  
  1427.  
  1428. DETConvertToNumberBlock = RECORD
  1429.     reqFunction: DETCallFunctions;        { Requested function }
  1430.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1431.                                             common to all invocations of code resource) }
  1432.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1433.                                             code resource) }
  1434.     callBack: DETCallBack;                { Pointer to call-back routine }
  1435.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1436.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1437.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1438.     property: INTEGER;                    { The property number the call refers to }
  1439.  
  1440.     theValue: LONGINT;                    { <-  The converted value to return }
  1441.     END;
  1442.  
  1443.  
  1444. DETConvertToRStringBlock = RECORD
  1445.     reqFunction: DETCallFunctions;        { Requested function }
  1446.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1447.                                             common to all invocations of code resource) }
  1448.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1449.                                             code resource) }
  1450.     callBack: DETCallBack;                { Pointer to call-back routine }
  1451.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1452.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1453.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1454.     property: INTEGER;                    { The property number the call refers to }
  1455.  
  1456.     theValue: RStringHandle;            { <-  A handle with the converted value (callee must allocate handle, DE will DisposHandle() it) }
  1457.     END;
  1458.  
  1459.  
  1460. DETConvertFromNumberBlock = RECORD
  1461.     reqFunction: DETCallFunctions;        { Requested function }
  1462.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1463.                                             common to all invocations of code resource) }
  1464.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1465.                                             code resource) }
  1466.     callBack: DETCallBack;                { Pointer to call-back routine }
  1467.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1468.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1469.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1470.     property: INTEGER;                    { The property number the call refers to }
  1471.  
  1472.     theValue: LONGINT;                    {  -> The value to convert (result should be written direct to the property) }
  1473.     END;
  1474.  
  1475.  
  1476. DETConvertFromRStringBlock = RECORD
  1477.     reqFunction: DETCallFunctions;        { Requested function }
  1478.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1479.                                             common to all invocations of code resource) }
  1480.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1481.                                             code resource) }
  1482.     callBack: DETCallBack;                { Pointer to call-back routine }
  1483.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1484.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1485.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1486.     property: INTEGER;                    { The property number the call refers to }
  1487.  
  1488.     theValue: RStringPtr;                {  -> The value to convert (result should be written direct to the property) }
  1489.     END;
  1490.  
  1491.  
  1492. DETCustomViewDrawBlock = DETCallBlockPropertyHeader;
  1493.  
  1494.  
  1495. DETCustomViewMouseDownBlock = RECORD
  1496.     reqFunction: DETCallFunctions;        { Requested function }
  1497.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1498.                                             common to all invocations of code resource) }
  1499.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1500.                                             code resource) }
  1501.     callBack: DETCallBack;                { Pointer to call-back routine }
  1502.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1503.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1504.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1505.     property: INTEGER;                    { The property number the call refers to }
  1506.  
  1507.     theEvent: ^EventRecord;                {  -> The original event record of the mouse-down }
  1508.     END;
  1509.  
  1510.  
  1511. DETCustomViewKeyPressBlock = RECORD
  1512.     reqFunction: DETCallFunctions;        { Requested function }
  1513.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1514.                                             common to all invocations of code resource) }
  1515.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1516.                                             code resource) }
  1517.     callBack: DETCallBack;                { Pointer to call-back routine }
  1518.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1519.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1520.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1521.     property: INTEGER;                    { The property number the call refers to }
  1522.  
  1523.     theEvent: ^EventRecord;                {  -> The original event record of the key-press }
  1524.     END;
  1525.  
  1526.  
  1527. DETCustomViewPasteBlock = RECORD
  1528.     reqFunction: DETCallFunctions;        { Requested function }
  1529.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1530.                                             common to all invocations of code resource) }
  1531.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1532.                                             code resource) }
  1533.     callBack: DETCallBack;                { Pointer to call-back routine }
  1534.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1535.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1536.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1537.     property: INTEGER;                    { The property number the call refers to }
  1538.  
  1539.     modifiers: INTEGER;                    { -> Modifiers at paste time (option/control/command/shift keys) }
  1540.     END;
  1541.  
  1542. DETCustomMenuSelectedBlock = RECORD
  1543.     reqFunction: DETCallFunctions;        { Requested function }
  1544.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1545.                                             common to all invocations of code resource) }
  1546.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1547.                                             code resource) }
  1548.     callBack: DETCallBack;                { Pointer to call-back routine }
  1549.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1550.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1551.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1552.  
  1553.     menuTableParameter: INTEGER;        {  -> The "property" field from the custom menu table }
  1554.     END;
  1555.  
  1556.  
  1557. DETCustomMenuEnabledBlock = RECORD
  1558.     reqFunction: DETCallFunctions;        { Requested function }
  1559.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1560.                                             common to all invocations of code resource) }
  1561.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1562.                                             code resource) }
  1563.     callBack: DETCallBack;                { Pointer to call-back routine }
  1564.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1565.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1566.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1567.  
  1568.     menuTableParameter: INTEGER;        {  -> The "property" field from the custom menu table }
  1569.     enable: BOOLEAN;                    { <-  Whether to enable the menu item }
  1570.     END;
  1571.  
  1572.  
  1573. DETForwarderListItem = RECORD
  1574.     next: ^DETForwarderListPtr;            { Pointer to next item, or nil }
  1575.     attributeValueTag: AttributeTag;    { Tag of new templates (0 for none) }
  1576.     rstrs: PackedPathName;                { Record type (empty if none), attrbute type (empty if none),
  1577.                                             aspect names to forward to, and info-page names to forward to }
  1578.     END;
  1579.  
  1580. DETForwarderListPtr = ^DETForwarderListItem;
  1581. DETForwarderListHandle = ^DETForwarderListPtr;
  1582.  
  1583. DETDynamicForwardersBlock = RECORD
  1584.     reqFunction: DETCallFunctions;        { Requested function }
  1585.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1586.                                             common to all invocations of code resource) }
  1587.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1588.                                             code resource) }
  1589.     callBack: DETCallBack;                { Pointer to call-back routine }
  1590.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1591.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1592.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1593.  
  1594.     forwarders: DETForwarderListHandle;    { <-  List of forwaders }
  1595.     END;
  1596.  
  1597.  
  1598. DETDynamicResourceBlock = RECORD
  1599.     reqFunction: DETCallFunctions;        { Requested function }
  1600.     templatePrivate: LONGINT;            { Private storage for use by code resource (stays for life of code resource,
  1601.                                             common to all invocations of code resource) }
  1602.     instancePrivate: LONGINT;            { Private storage for use by code resource (separate for each item using the
  1603.                                             code resource) }
  1604.     callBack: DETCallBack;                { Pointer to call-back routine }
  1605.     callBackPrivate: LONGINT;            { Private data for the call-back routine }
  1606.     target: DETTargetSpecification;        { The target (originator) of the call, for targeted and property calls }
  1607.     targetIsMainAspect: BOOLEAN;        { True if the target is the main aspect (even though it has a non-nil name) }
  1608.  
  1609.     resourceType: ResType;                {  -> The resource type being requested }
  1610.     propertyNumber: INTEGER;            {  -> The property number of the resource being requested }
  1611.     resourceID: INTEGER;                {  -> The resource ID (base ID + property number) of the resource }
  1612.     theResource: Handle;                { <-  The requested resource }
  1613.     END;
  1614.  
  1615.  
  1616.  
  1617. DETCallBlock = RECORD
  1618.     CASE INTEGER OF
  1619.         1: (protoCall: DETProtoCallBlock);
  1620.         2: (init: DETInitBlock);
  1621.         3: (exit: DETExitBlock);
  1622.         4: (instanceInit: DETInstanceInitBlock);
  1623.         5: (instanceExit: DETInstanceExitBlock);
  1624.         6: (instanceIdle: DETInstanceIdleBlock);
  1625.         7: (propertyCommand: DETPropertyCommandBlock);
  1626.         8: (controlEnabled: DETControlEnabledBlock);
  1627.         9: (maximumTextLength: DETMaximumTextLengthBlock);
  1628.         10: (viewListChanged: DETViewListChangedBlock);
  1629.         11: (propertyDirtied: DETPropertyDirtiedBlock);
  1630.         12: (validateSave: DETValidateSaveBlock);
  1631.         13: (dropQuery: DETDropQueryBlock);
  1632.         14: (dropMeQuery: DETDropMeQueryBlock);
  1633.         15: (attributeCreationBlock: DETAttributeCreationBlock);
  1634.         16: (attributeNew: DETAttributeNewBlock);
  1635.         17: (attributeChange: DETAttributeChangeBlock);
  1636.         18: (attributeDelete: DETAttributeDeleteBlock);
  1637.         19: (patternIn: DETPatternInBlock);
  1638.         20: (patternOut: DETPatternOutBlock);
  1639.         21: (shouldSync: DETShouldSyncBlock);
  1640.         22: (doSync: DETDoSyncBlock);
  1641.         23: (openSelf: DETOpenSelfBlock);
  1642.         24: (convertToNumber: DETConvertToNumberBlock);
  1643.         25: (convertToRString: DETConvertToRStringBlock);
  1644.         26: (convertFromNumber: DETConvertFromNumberBlock);
  1645.         27: (convertFromRString: DETConvertFromRStringBlock);
  1646.         28: (customViewDraw: DETCustomViewDrawBlock);
  1647.         29: (customViewMouseDown: DETCustomViewMouseDownBlock);
  1648.         30: (customViewKeyPress: DETCustomViewKeyPressBlock);
  1649.         31: (customViewPaste: DETCustomViewPasteBlock);
  1650.         32: (customMenuSelected: DETCustomMenuSelectedBlock);
  1651.         33: (customMenuEnabled: DETCustomMenuEnabledBlock);
  1652.         34: (dynamicForwarders: DETDynamicForwardersBlock);
  1653.         35: (dynamicResource: DETDynamicResourceBlock);
  1654.     END;
  1655.  
  1656. DETCallBlockPtr = ^DETCallBlock;
  1657.  
  1658. { Call-for list: }
  1659.  
  1660. CONST
  1661. kDETCallForAnything               = 1;        { Call at all }
  1662. kDETCallForIdle                   = 2;        { kDETcmdIdle }
  1663. kDETCallForCommands               = 4;        { kDETcmdPropertyCommand, kDETcmdSelfOpen }
  1664. kDETCallForViewChanges           = 8;        { kDETcmdControlEnabled, kDETcmdViewListChanged, kDETcmdPropertyDirtied, kDETcmdMaximumTextLength }
  1665. kDETCallForDrops            = $10;        { kDETcmdDropQuery, kDETcmdDropMeQuery }
  1666. kDETCallForAttributes        = $20;        { kDETcmdAttributeNew, kDETcmdAttributeChange }
  1667. kDETCallForValidation        = $40;        { kDETcmdValidateSave }
  1668. kDETCallForKeyPresses        = $80;        { kDETcmdCustomViewKeyPress and kDETcmdCustomViewPaste on all key-presses }
  1669. kDETCallForResources        = $100;        { kDETcmdDynamicResource }
  1670. kDETCallForSyncing            = $200;        { kDETcmdShouldSync, kDETcmdDoSync }
  1671. kDETCallForEscalation        = $8000;    { all calls escalated to the next level }
  1672.  
  1673. kDETCallForNothing               = 0;        { none of the above }
  1674. kDETCallForEverything = $FFFFFFFF;        { all of the above }
  1675.  
  1676. TYPE
  1677. DETCall = ProcPtr;        { FUNCTION DETCall(callBlockPtr: DETCallBlockPtr): OSErr;}
  1678.  
  1679.  
  1680. { This following macro saves you from having to dig out the call-back pointer from the call block: }
  1681.  
  1682. { #define CallBackDET(callBlockPtr, callBackBlockPtr) ((*callBlockPtr->protoCall.callBack)(callBlockPtr, callBackBlockPtr)) }
  1683.  
  1684.  
  1685. { Errors specific to Directories Extension Templates }
  1686.  
  1687. { Note: This section will be moved to OCEErrors.h eventually }
  1688.  
  1689.  
  1690.  
  1691. { ************************************************************************************ }
  1692. { ********************************* SAM Definitions: ********************************* }
  1693. { ************************************************************************************ }
  1694.  
  1695.  
  1696. { SAM Developers should use property numbers starting at this point: }
  1697. CONST
  1698. kSAMFirstDevProperty = kDETFirstDevProperty + 10;
  1699.  
  1700.  
  1701. {
  1702.     SAM templates have additional resources/properties that are required
  1703.     for interaction with the A.O.C.E. Connections control panel.
  1704.     
  1705.      Type    Offset                        Description
  1706.      ----    ------                        -----------
  1707.     'rstr'    kSAMAspectStatus            The string displayed as the slot's status
  1708.     'detn'    kSAMAspectCannotDelete        If 0, then the slot cannot be deleted
  1709.     'detn'    kSAMAspectServesDSAM        If 0, not a DSAM template, otherwise is a DSAM template
  1710.     'detn'    kSAMAspectServesMSAM        If 0, not an MSAM template, otherwise is an MSAM template
  1711.     'sami'    kSAMAspectSlotCreationInfo    The info required to create a slot record
  1712. }
  1713.  
  1714. CONST
  1715. kSAMAspectStatus            = kDETFirstDevProperty + 1;
  1716. kSAMAspectCannotDelete        = kDETFirstDevProperty + 2;
  1717. kSAMAspectServesDSAM        = kDETFirstDevProperty + 3;
  1718. kSAMAspectServesMSAM        = kDETFirstDevProperty + 4;
  1719. kSAMAspectSlotCreationInfo    = kDETFirstDevProperty + 5;
  1720.  
  1721.  
  1722. {    The standard "Status" RStrings are stored in an rst# resource.
  1723.     Here is the resource ID and the indices into the resource }
  1724.  
  1725. CONST
  1726. kSAMStatusStrings    = -16523;
  1727. kSAMNotSetup        = 1;
  1728. kSAMActive            = 2;
  1729. kSAMInactive        = 3;
  1730.  
  1731. { ************************************************************************************** }
  1732. { ********************************* Admin Definitions: ********************************* }
  1733. { ************************************************************************************** }
  1734.  
  1735. kDETAdminVersion    = -978;
  1736.  
  1737. {$ENDC}    { UsingOCETemplates }
  1738.  
  1739. {$IFC NOT UsingIncludes}
  1740.     END.
  1741. {$ENDC}
  1742.